﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Exhibition.Dao.ViewModel;
using Exhibition.Service;

namespace Exhibition
{
    public partial class NewsList : BasePage
    {
        int tpid = 0;
        public NavModel nav = new NavModel();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["tpid"] != null)
            {
                try
                {
                    tpid = Convert.ToInt32(Request["tpid"]);
                   nav=   CenterService.navService.GetOneById(tpid);
                }catch(Exception){

                    Response.Write("系统错误，请联系管理员");
                }
            }

            if (!IsPostBack) {
                LoadData();
            }
        }

        private void LoadData()
        {
            int outcount = 0;
            List<ContentModel> ctms = CenterService.contentService.GetNews(pager.StartRecordIndex, pager.PageSize, out outcount, tpid);
            pager.RecordCount = outcount;
            repList.DataSource = ctms;
            repList.DataBind();
        }

        protected void pager_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            LoadData();
        }
    }
}